<%@page contentType="text/html; charset=utf-8"%>
<script type="text/javascript" src="../../components/jscommons/jquery-1.7.1.min.js"></script>
<script type="text/javascript">
	var workflowCode = '<%=request.getParameter("workflowCode")%>';
	$(document).ready(function() {
		dispalyValue();
	});
	function dispalyValue(){
		jQuery.post("/finance/workflow/queryWorkflowAndNodes.do",{workflowCode:workflowCode},function(str){
			//alert(str);
			var data = eval('(' + str + ')');
			$("#workflowName_textfield").val(data.workflowName);
			//$("#amount_textfield").val(data.amount);
			$("#workflowdescription_textarea").val(data.workflowDescription);
			$("#workflowCode_hidden").val(workflowCode);
			$("#formCode_span_id").html(data.formCode);
			var htmltxtcontent = '<tr><td align="left">'+"申请人:"+data.applyUserName+"&nbsp;&nbsp;申请时间:"+data.createTime+'</td></tr>';
			for (var i=0; i<data.data.length; i++) {
				if(data.data[i].nodeCode==2){
					 htmltxtcontent += '<tr><td align="left">'+"审核人:"+data.data[i].assessorName+"&nbsp;&nbsp;审核结果:"+(data.data[i].approveResult==''?"没有填写":data.data[i].approveResult)+"&nbsp;&nbsp;审核时间:"+data.data[i].createTime+'</td></tr>';
				}else if(data.data[i].nodeCode==3){
					htmltxtcontent += '<tr><td align="left">'+"审批人:"+data.data[i].approveName+"&nbsp;&nbsp;审核结果:"+(data.data[i].approveResult==''?"没有填写":data.data[i].approveResult)+"&nbsp;&nbsp;审核时间:"+data.data[i].createTime+'</td></tr>';
				}
			}
			$("#auditResult_td").html(htmltxtcontent);
        });
	}
	function audit(){
		jQuery.post("/finance/workflow/createAuditor.do",{workflowCode:$("#workflowCode_hidden").val(),approveResult:$("#approveResult_textarea").val()},function(str){
			//alert(str);
			var data = eval('(' + str + ')');
			if(data.success){
				dispalyValue();
				alert("审核意见已提交");
			}
        });
	}
</script>
<div id="rightsiber">
           	  <h1>业务审批</h1>
              
               <div class="titer">1.事件审批>>B、审核页面</div>
              <form action="" method="get">
              	<input type="hidden" id="workflowCode_hidden" name="workflowCode"/>
				<table class="form" width="800" border="0" cellspacing="0" cellpadding="0">
                     <tr>
                        <td width="150" height="50" align="right" valign="middle"><p >单号： </p></td>
                        <td align="left" valign="middle"><label>
                          <span id="formCode_span_id"></span>
                        </label></td>
                      </tr>
                      <tr>
                        <td width="150" height="50" align="right" valign="middle"><p >申请名称： </p></td>
                        <td align="left" valign="middle"><label>
                          <input class="inputa" type="text" name="textfield" id="workflowName_textfield" disabled="disabled"/>
                        </label></td>
                      </tr>
                      <tr>
                        <td width="150" height="50" align="right" valign="top"><p >事件描述： </p></td>
                        <td align="left" valign="middle"><label>
                          <textarea name="textarea" id="workflowdescription_textarea" cols="45" rows="5" disabled="disabled"></textarea>
                        </label></td>
          			  </tr>
          			  <tr>
          			  	<td width="150" height="50" align="right" valign="top"><p >核批结果： </p></td>
          			  	<td align="left" valign="middle" id="auditResult_td"></td>
          			  </tr>
                      
                      <tr>
                        <td height="50" align="right" valign="middle"><p >审核意见： </p></td>
                        <td align="left" valign="middle"><textarea name="textarea2" id="approveResult_textarea" cols="45" rows="5"></textarea></td>
                      </tr>
                      <tr>
                        <td width="150" height="50" align="right" valign="middle">&nbsp;</td>
                        <td align="left" valign="middle"><label>
                          <input type="button" name="button" id="button"  class="inputb" value="提交"  onclick="audit();"/>
                          <input type="reset" name="button2" id="button2" class="inputb" value="重置" />
                        </label></td>
                      </tr>
                </table>
              </form>

            </div>